﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Vanfa.Entities.Album;
using Vanfa.Queries.Sql.DbQueries;
using Vanfa.Queries.Sql.DbModel;
using Vanfa.Common.Crypto;

namespace Vanfa.Biz.Album
{
    public class UserPhotoMag
    {
        /// <summary>
        /// 上传照片
        /// </summary>
        /// <param name="vup"></param>
        /// <returns></returns>
        public static bool Upload(vUserPhoto vup)
        {
            return AlbumQry.New.Insert(vup.ToDbEntity()) > 0;
        }

        public static IList<vUserPhoto> Select(int userID)
        {
            var dp = AlbumQry.New.Select(userID);
            if (dp == null || dp.Count() == 0)
                return null;
            IList<vUserPhoto> bup = new List<vUserPhoto>();
            foreach (var p in dp)
            {
                bup.Add(p.ToBizEntity());
            }
            return bup;
        }
    }
}
